package ${packageName};
<#if applicationPackage??>
import ${applicationPackage}.R;
import androidx.annotation.Nullable;
import com.zxn.presenter.view.BaseFragment;
import android.os.Bundle;
</#if>

/**
 * Created by zxn on ${.now}.
 * 
 */
public class ${className} extends BaseFragment {

<#if includeFactory>
    
    private static final String ARG_PARAM1 = "arg_param1";
    private String mParam1;
</#if>

    @BindView(R.id.rv_)
    RecyclerView ${generateRv("${className}")};

<#if includeFactory>

	public static ${className} newInstance(String param1) {
        ${className} fragment = new ${className}();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        fragment.setArguments(args);
        return fragment;
    }

    public static ${className} newInstance() {
        ${className} fragment = new ${className}();
        return fragment;
    }
</#if>
    public ${className}() {
    }

<#if includeFactory>

	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    if (getArguments() != null) {
	        mParam1 = getArguments().getString(ARG_PARAM1);
	    }
	}
</#if>

    @Override
    protected int getLayoutResId() {
        return R.layout.${fragmentName};
    }

	    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        onCreateRecyclerView();
    }

    private void onCreateRecyclerView() {
        ${generateRv("${className}")}.setLayoutManager(new LinearLayoutManager(mContext));
        ${generateRv("${className}")}.setHasFixedSize(true);
        ${generateRv("${className}")}.addItemDecoration(new RvItemDecoration.Builder(mContext)
                .bgColor(R.color.colorPrimary)
                .widthDp(1f)
                .setOrientation(LinearDecoration.VERTICAL)
                .createLinear());
                
        /*mAdapter = new ${generateAdapter("${className}")}();      
        ${generateRv("${className}")}.setAdapter(mAdapter);
        mAdapter.setOnItemClickListener((adapter, view, position) -> {

        });*/
        
        
        /*mAdapter.setOnItemChildClickListener((adapter, view, position) -> {
            
        });*/

        /*mAdapter.addHeaderView(new ${generateHeader("${className}")}(this).getView());*/
    }
}

<#function generateRv className>
  <#return "m" + className?replace("Frag", "Rv")>
</#function>

<#function generateAdapter className>
  <#return className?replace("Frag", "Adapter")>
</#function>

<#function generateHeader className>
  <#return className?replace("Frag", "Header")>
</#function>
